//
//  BSTextCell.m
//  BS
//
//  Created by lanou on 15/8/17.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "BSTextCell.h"

#import "Header.h"

#import "UILabel+LJLabel.h"
#import "BSUserSetting.h"

@implementation BSTextCell


- (void)setModel:(BSListModel *)model{
    
    _model = model;
    
    BSUserSetting *user = [BSUserSetting userSettingManager];
    _contentLabel.font = [UIFont systemFontOfSize:user.sizeFont];

    _contentLabel.text = model.text;
    //自定义行间距
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:model.text];
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle setLineSpacing:5];//调整行间距
    [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [model.text length])];
    _contentLabel.attributedText = attributedString;
    
}


+ (CGFloat)heightOfCell:(BSListModel *)model{

    if (model.cellHeight == 0) {
        model.cellHeight = [UILabel heightOfLabelByStr:model.text fontSize:[BSUserSetting userSettingManager].sizeFont width:SCREEN_WIDTH - 2 * 8 lineSpacing:5] + 20;
    }
    return model.cellHeight;
}

@end
